import { draw } from "../../utils/api";
Page({
  data: {
    score: "",
    imgIdx: 1,
  },
  onLoad() {
    let eventChannel = this.getOpenerEventChannel();
    eventChannel.on("homeEvent", (data) => {
      this.setData({
        score: data.toFixed(2),
      });
    });
  },
  // 立刻开奖
  draw_prize() {
    draw({
      data: {
        score: this.data.score,
      },
      success: (res) => {
        console.log(res);
        wx.navigateTo({
          url: "/pages/award/award?prizeid=" + res.data.prizeid,
        });
      },
    });
  },
});
